package org.adream.account.util;

import java.io.IOException;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import com.sensorsdata.analytics.javasdk.SensorsAnalytics;

@Component
public class SensorDataUtil {
	
	@Value("${sensor.data.logfile}")
	private String sdLogFile;
	
	public static SensorsAnalytics sa;
	
	private final static Logger logger = Logger.getLogger(SensorDataUtil.class);
	
	public SensorsAnalytics getSensorsAnalytics() throws IOException {
		if(sa == null) {
			sa = new SensorsAnalytics(new SensorsAnalytics.ConcurrentLoggingConsumer(sdLogFile));			
		}
		return sa;
	}
}